<?php

namespace App\Http\Controllers;

use App\Models\Feedback;
use App\Requests\FeedbackRequest;

class FeedbackController extends Controller
{
    public function store(FeedbackRequest $request)
    {
        $data = $request->validated();
        if (isset($data['photos']) && is_array($data['photos'])) {
            $data['photos'] = json_encode($data['photos']);
        }
        $data['user_id'] = auth()->user()->id;
        Feedback::create($data);
        return response_success();
    }
}